package com.sc.nft.entity.vo.ecology;

import cn.hutool.core.util.ObjectUtil;
import com.sc.nft.enums.EcologyHatchDaoIncomeDimensionalityEnum;
import com.sc.nft.enums.EcologyIncomeTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class AdminDaoEcologyIncomePageVO {


    @ApiModelProperty(value = "id")
    private Long id;

    @ApiModelProperty(value = "daoId")
    private Long daoId;

    @ApiModelProperty(value = "DAO 名称")
    private String daoName;

    @ApiModelProperty(value = "藏品id")
    private Long collectionId;

    @ApiModelProperty(value = "分红名称")
    private String dividendIncomeName;

    @ApiModelProperty(value = "藏品名称")
    private String firstTitle;

    @ApiModelProperty(value = "身份名称")
    private String incomeName;

    @ApiModelProperty(value = "DAO分红类型 DAO_CULTIVATION_AWARD:DAO培育奖 DAO_CONTRIBUTION_AWARD:DAO贡献奖")
    private EcologyIncomeTypeEnum daoIncomeType;

    @ApiModelProperty(value = "统计维度 SEVEN_DAYS:7天 THREE_HUNDRED_AND_SIXTY_FIVE:365天")
    private EcologyHatchDaoIncomeDimensionalityEnum dimensionality;

    @ApiModelProperty(value = "统计维度(天数)")
    private Integer dimensionalityDays;

    @ApiModelProperty(value = "收益比例")
    private String incomeScale;

    @ApiModelProperty(value = "是否上架")
    private Boolean status;

    @ApiModelProperty(value = "创建人")
    private String createName;

    @ApiModelProperty(value = "直推人数")
    private Integer directThrustUserCount;

    @ApiModelProperty(value = "持有的藏品id")
    private Long holdCollectionId;

    @ApiModelProperty(value = "持有的藏品名称")
    private String holdCollectionName;

    @ApiModelProperty(value = "熔炼藏品id")
    private Long hatchCollectionId;

    @ApiModelProperty(value = "熔炼藏品")
    private String hatchCollectionName;




    public void setIncomeScale(BigDecimal incomeScale) {
        this.incomeScale = incomeScale.stripTrailingZeros().toPlainString();
    }

    public void setDaoIncomeType(EcologyIncomeTypeEnum daoIncomeType) {
        this.daoIncomeType = daoIncomeType;
        this.incomeName = daoIncomeType.getDescription();
    }

    public void setDimensionality(EcologyHatchDaoIncomeDimensionalityEnum dimensionality) {
        if(ObjectUtil.isNull(dimensionality)){
            this.dimensionality = null;
            this.dimensionalityDays = null;
            return;
        }
        this.dimensionality = dimensionality;
        this.dimensionalityDays = dimensionality.getDays();
    }
}
